<!-- eslint-disable vue/no-use-v-if-with-v-for -->
<template>
  <div class="bgys">
    <!-- 
      头部标题
     -->
    <head-main :audioUrl="audioUrl" @bfwc="bfwc" />
    <!-- 任务栏 -->
    <div class="tool taskclosebox" @click="closefn" v-if="!erstepshow">
      <img src="@/images/taskclose.png" alt="" class="normal" />
      <img src="@/images/taskcloseac.png" alt="" class="active" />
    </div>
    <div class="taskbox beautifulScroll">
      <!-- 一级菜单 -->
      <div
        class="tool taskboxitem"
        v-for="item in taskdata"
        :key="item.id"
        @click="taskfn(item.id)"
        v-show="item.id == erstep || erstepshow"
      >
        <img
          src="@/images/taska.png"
          alt=""
          class="normal bgm"
          v-if="taskstep != item.id"
        />
        <img
          src="@/images/taskac.png"
          alt=""
          class="active bgm"
          v-if="taskstep != item.id"
        />
        <img
          src="@/images/taskac.png"
          alt=""
          v-if="taskstep == item.id"
          class="bgm"
        />
        <!-- 序号 -->
        <span class="taskitemid">{{ item.id }}</span>
        <!-- 名字 -->
        <span class="taskitemname">{{ item.name }}</span>
      </div>
      <!-- 二级菜单 -->
      <div class="erbox" v-if="!erstepshow">
        <div v-for="items in taskdata[erstep - 1].erdata" :key="items.id">
          <div
            :class="eritem == items.id ? 'erboxitem erboxitemac ' : 'erboxitem'"
            @click="erjifn(items.id)"
          >
            <span>{{ items.name }}</span>
          </div>
          <!--  三级菜单 变态反人类设计 当点击的二级菜单 = 三级菜单的时候才让他显示-->
          <div class="sjbox" v-if="eritem == items.id && sjbox">
            <div
              :class="itemsd.id == sjstep ? 'sjitemac sjitem' : 'sjitem'"
              v-for="itemsd in items.sandata"
              :key="itemsd.id"
              @click="sjstep = itemsd.id"
            >
              <span>{{ itemsd.name }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 准备工作服物品栏步骤-->
    <wp-tool
      v-if="taskstep == 1"
      :eritem="eritem"
      @tg="tg"
      @eritemfn="eritemfn"
    />
    <!-- 静脉采血步骤 -->
    <jmcx-bz
      ref="jmcxbz"
      @eritemfn="eritemfn"
      :eritem="eritem"
      v-if="taskstep == 2"
      @audioUrlfn="audioUrlfn"
      @taskfn="taskfn"
    />
    <!-- 生化分析步骤 工作站相关操作 -->

    <sh-fx
      ref="shfx"
      @taskfn="taskfn"
      :eritem="eritem"
      @eritemfn="eritemfn"
      :sjstep="sjstep"
      v-if="taskstep == 5"
      @sjstepfn="sjstepfn"
      :sjname="sjname"
      @eritemfns="eritemfns"
    />
    <!-- 临时工作站 -->

    <!--  -->
    <div class="gzlll" v-if="gzlshow">
      <img src="@/images/gz51.png" alt="" class="gzzimg" />

      <div class="gzicons"></div>
      <img src="@/images/sratss.png" alt="" class="gzicon" @click="gzlshowfn" />
    </div>
    <div class="gzlll" v-if="gzllshow1">
      <img src="@/images/13.png" alt="" class="gzzimg" />
      <div class="gzicons"></div>
      <img
        src="@/images/sratss.png"
        alt=""
        class="gzicon"
        @click="
          ;(gzllshow2 = true), (bztext = '点击绿色的Start按钮开始分析标本')
        "
      />
      <img
        src="@/images/13st.png"
        alt=""
        class="st tm"
        v-if="gzllshow2"
        @click="gzllshow2fn"
      />
    </div>
    <!-- 场景文件 -->
    <seen
      :eritem="eritem"
      :eritems="eritems"
      :sjstep="sjstep"
      :taskstep="taskstep"
      ref="seen"
      @clickItem="clickItem"
      @tipstextfn="tipstextfn"
    />
    <!-- 步骤提示 -->
    <bz-tip :bztext="bztext" v-if="bztext" />
    <!-- 文字提示 -->
    <right-tips :tipstext="tipstext" v-if="tipstext" />
    <!-- 警示文字 -->
    <error-tips :errortext="errortext" v-if="errortext" />
    <!-- 操作面板UI -->
    <div class="szuibox" v-if="szuiboxshow">
      <img src="@/images/czuibo.png" alt="" class="czuibo" />
      <div class="tool sjia" @click="sjia">
        <i class="el-icon-plus sjiaiocn"></i>
        <img src="@/images/jiad.png" alt="" class="normal" />
        <img src="@/images/jiadac.png" alt="" class="active" />
      </div>
      <div class="tool sjias" @click="sjias">
        <i class="el-icon-plus sjiaiocn"></i>
        <img src="@/images/jiad.png" alt="" class="normal" />
        <img src="@/images/jiadac.png" alt="" class="active" />
      </div>
      <div class="tool sjiaa" @click="sjiaa">
        <i class="el-icon-minus sjiaiocn"></i>
        <img src="@/images/jiad.png" alt="" class="normal" />
        <img src="@/images/jiadac.png" alt="" class="active" />
      </div>
      <div class="tool sjiaas" @click="sjiaas">
        <i class="el-icon-minus sjiaiocn"></i>
        <img src="@/images/jiad.png" alt="" class="normal" />
        <img src="@/images/jiadac.png" alt="" class="active" />
      </div>
      <div class="szuir">{{ szuir }}</div>
      <div class="szuit">{{ szuit }}</div>
    </div>
    <!-- 报告单签单 -->
    <div class="imgbgbox" v-if="imgbgboxshow">
      <img src="@/images/15.png" alt="" class="imgbg" />
      <el-button type="primary" class="qdss" @click="eritem = 12"
        >签 字</el-button
      >
    </div>
    <!-- 擦洗探针顺序弹窗 -->
    <div class="cxtzbox" v-if="sjstep == 2 && taskstep == 5 && eritem == 12">
      <div class="qxtzbt">清洗探针顺序</div>
      <div class="tzimgbox">
        <img src="@/images/tzimg.png" alt="" />
      </div>
      <div class="qxtzmain">
        <div class="qxitem">1.打开探针罩子</div>
        <div class="qxitemimg"><img src="@/images/tzjt.png" alt="" /></div>
        <div class="qxitem">
          2.使用蘸75%酒精的干净纱布擦拭标本探针、试剂探针、预冲洗针
        </div>
        <div class="qxitemimg"><img src="@/images/tzjt.png" alt="" /></div>
        <div class="qxitem">
          3.使用蘸蒸馏水的干净纱布擦拭标本探针、试剂探针、预冲洗针
        </div>
        <div class="qxitemimg"><img src="@/images/tzjt.png" alt="" /></div>
        <div class="qxitem">4.使用干净纱布擦拭标本探针、试剂探针、预冲洗针</div>
        <div class="qxitemimg"><img src="@/images/tzjt.png" alt="" /></div>
        <div class="qxitem">5.关闭探针罩子</div>
      </div>
      <div class="qxqdtm">
        <el-button type="primary" @click="sjstep = 3">确 定</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { mixins } from '@/mixin/index'
import headMain from '@/components/headMain.vue'
import WpTool from '@/components/wpTool.vue'
import JmcxBz from '@/components/jmcxBz.vue'
import ShFx from '@/components/shFx.vue'
import Seen from './seen.vue'
import BzTip from '@/components/bzTip.vue'
import RightTips from '@/components/rightTips.vue'
import ErrorTips from '@/components/errorTips.vue'

export default {
  mixins: [mixins], //混入
  components: {
    headMain,
    WpTool,
    JmcxBz,
    ShFx,
    Seen,
    BzTip,
    RightTips,
    ErrorTips
  },
  name: 'WorkspaceJsonIndex',
  data() {
    return {
      szuiboxshow: false,
      imgbgboxshow: false,
      gzlshow: false,
      gzllshow1: false,
      gzllshow2: false,
      szuir: 0,
      szuit: 0,
      audioUrl: '',
      tipstext: '',
      errortext: '',
      timer: null,
      taskstep: 1, //当前所在一级分类
      erstepshow: false, //二级菜单开启标识2
      sjbox: false,
      taskdata: [
        {
          id: 1,
          name: '准备',
          erdata: [
            {
              id: 1,
              name: '穿工作服'
            },
            {
              id: 2,
              name: '洗手'
            },
            {
              id: 3,
              name: '戴口罩'
            },
            {
              id: 4,
              name: '戴手套'
            }
          ]
        },
        {
          id: 2,
          name: '静脉采血',
          erdata: [
            {
              id: 1,
              name: '采血前准备'
            },
            {
              id: 2,
              name: '核对患者信息'
            },
            {
              id: 3,
              name: '绑扎压脉带'
            },
            {
              id: 4,
              name: '采血点消毒'
            },
            {
              id: 5,
              name: '采血'
            },
            {
              id: 6,
              name: '拔针按压'
            },
            {
              id: 7,
              name: '标本处理'
            }
          ]
        },
        {
          id: 3,
          name: '样品离心',
          erdata: [
            {
              id: 1,
              name: '开机'
            },
            {
              id: 2,
              name: '放入样品'
            },
            {
              id: 3,
              name: '放入平衡试管'
            },
            {
              id: 4,
              name: '设置参数'
            },
            {
              id: 5,
              name: '开始样品离心'
            },
            {
              id: 6,
              name: '取出样品'
            },
            {
              id: 7,
              name: '检查样品'
            }
          ]
        },
        {
          id: 4,
          name: '样品开盖',
          erdata: [
            {
              id: 1,
              name: '放入样品'
            },
            {
              id: 2,
              name: '开盖'
            }
          ]
        },
        {
          id: 5,
          name: '生化分析',
          erdata: [
            {
              id: 1,
              name: '检查仪器'
            },
            {
              id: 2,
              name: '仪器开机'
            },
            {
              id: 3,
              name: '登录工作站'
            },
            {
              id: 4,
              name: '开机保养'
            },
            {
              id: 5,
              name: '检查试剂'
            },
            {
              id: 6,
              name: '更换试剂'
            },
            {
              id: 7,
              name: '检查清洗液'
            },
            {
              id: 8,
              name: '校准定标',
              sandata: [
                {
                  id: 1,
                  name: '准备校准品'
                },
                {
                  id: 2,
                  name: '下载该批号校准品'
                },
                {
                  id: 3,
                  name: '分配指定定标液'
                },
                {
                  id: 4,
                  name: '选定校准项目'
                },
                {
                  id: 5,
                  name: '放入校准品'
                },
                {
                  id: 6,
                  name: '开始校准'
                },
                {
                  id: 7,
                  name: '校准完成'
                },
                {
                  id: 8,
                  name: '查看定标结果'
                }
              ]
            },
            {
              id: 9,
              name: '质控',
              sandata: [
                {
                  id: 1,
                  name: '准备质控品'
                },
                {
                  id: 2,
                  name: '下载该批号质控品'
                },
                {
                  id: 3,
                  name: '分配指定质控品'
                },
                {
                  id: 4,
                  name: '勾选常规质控项目'
                },
                {
                  id: 5,
                  name: '放入质控品'
                },
                {
                  id: 6,
                  name: '开始质控'
                },
                {
                  id: 7,
                  name: '质控完成'
                },
                {
                  id: 8,
                  name: '查看质控结果'
                }
              ]
            },
            {
              id: 10,
              name: '标本分析',
              sandata: [
                {
                  id: 1,
                  name: '确定标本信息'
                },
                {
                  id: 2,
                  name: '编辑标本项目'
                },
                {
                  id: 3,
                  name: '放入标本'
                },
                {
                  id: 4,
                  name: '开始分析标本'
                },
                {
                  id: 5,
                  name: '分析完成'
                },
                {
                  id: 6,
                  name: '查看分析结果'
                }
              ]
            },
            {
              id: 11,
              name: '打印报告单'
            },
            {
              id: 12,
              name: '常规维护',
              sandata: [
                {
                  id: 1,
                  name: '启动人工清洁程序'
                },
                {
                  id: 2,
                  name: '擦洗探针'
                },
                {
                  id: 3,
                  name: '关闭人工清洁程序'
                },
                {
                  id: 4,
                  name: '执行仪器复位程序'
                }
              ]
            },
            {
              id: 13,
              name: '关机维护'
            },
            {
              id: 14,
              name: '仪器关机'
            }
          ]
        }
      ],
      erstep: 1, // 在二级菜单 第一个展示当前所在的一级菜单名
      eritem: 1, //当前所在二级步骤
      sjstep: 1,
      sjname: '',
      bztext: '',
      eritems: 0
    }
  },

  mounted() {},
  watch: {
    szuir: {
      handler(i) {
        console.log('当前i', i, '当前su', this.szuit)
        if (i == 3500 && this.szuit == 5) {
          this.timer = setTimeout(() => {
            clearTimeout(this.timer)
            this.eritem = 5
          }, 800)
        }
      },
      immediate: true,
      deep: true
    },
    szuit: {
      handler(i) {
        console.log('当前i', i, '当前su', this.szuir)
        if (i == 5 && this.szuir == 3500) {
          this.timer = setTimeout(() => {
            clearTimeout(this.timer)
            this.eritem = 5
          }, 800)
        }
      },
      immediate: true,
      deep: true
    },
    sjstep: {
      handler(i) {
        this.gzlshow = false
        this.gzllshow1 = false
        this.gzllshow2 = false
        this.imgbgboxshow = false
        this.eritems = this.eritem
        this.bztext = ''
        if (i == 1) {
          this.sjbox = true
        }
        // if (ol == 1) {
        //   this.sjbox = true
        // }
        if (this.eritem == 8 && this.taskstep == 5 && i == 1) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(-3.206, 1.686, -3.46)
          this.$refs.seen.move(
            [-1.836, 1.689, -1.071],
            [-6.77 / 180, 0.27 / 180, 0.03 / 180]
          )
          this.bztext = '点击冰箱，取出校准品'
        }
        if (this.eritem == 9 && this.taskstep == 5 && i == 1) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(-3.206, 1.686, -3.46)
          this.$refs.seen.move(
            [-1.836, 1.689, -1.071],
            [-6.77 / 180, 0.27 / 180, 0.03 / 180]
          )
          this.bztext = '点击冰箱，取出质控品'
        }
        if (i == 5 && this.taskstep == 5 && this.eritem == 8) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.706, 1.325, -3.991)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '打开进样口盖子'
        }
        if (i == 6 && this.taskstep == 5 && this.eritem == 8) {
          this.$refs.seen.initFileS(1)
          this.gzlshow = true
          this.bztext = '点击右侧的Start按钮开始校准'
        }
        if (i == 7 && this.taskstep == 5 && this.eritem == 8) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.706, 1.325, -3.991)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '打开进样口盖子'
        }
        if (i == 5 && this.taskstep == 5 && this.eritem == 9) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.706, 1.325, -3.991)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '打开进样口盖子'
        }
        if (i == 6 && this.taskstep == 5 && this.eritem == 9) {
          // this.$refs.seen.initFileS(1)
          this.gzlshow = true
          this.bztext = '点击右侧的Start按钮开始校准'
        }
        if (i == 7 && this.taskstep == 5 && this.eritem == 9) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.706, 1.325, -3.991)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '打开进样口盖子'
        }
        if (i == 3 && this.taskstep == 5 && this.eritem == 10) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.706, 1.325, -3.991)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '打开进样口盖子'
        }
        if (i == 4 && this.taskstep == 5 && this.eritem == 10) {
          // this.$refs.seen.initFileS(1)
          this.gzllshow1 = true
          this.bztext = '点击左侧侧的Start按钮开始校准'
        }
        if (i == 5 && this.taskstep == 5 && this.eritem == 10) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.706, 1.325, -3.991)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '打开进样口盖子'
        }
        console.log('当前三级菜单检测到数据变化')
      },
      immediate: true,
      deep: true
    },
    taskstep: {
      handler(i) {
        console.log('', i)
        clearTimeout(this.timer)
        this.eritem = 1
        if (this.eritem == 1 && i == 3) {
          this.$refs.seen.initFileS(0)
          this.$refs.seen.twinklePoint(15.522, 1.211, -2.6)
          this.$refs.seen.move(
            [14.192, 2.092, -2.688],
            [-89.45 / 180, -58.44 / 180, -89.35 / 180]
          )
          this.bztext = '点击打开离心机电源'
        }
        if (this.eritem == 1 && i == 4) {
          this.$refs.seen.initFileS(0)
          this.$refs.seen.twinklePoint(15.466, 1.213, -3.625)
          this.$refs.seen.move(
            [14.169, 1.818, -3.955],
            [-90.0 / 180, -66.79 / 180, -90.0 / 180]
          )
          this.bztext = '点击离心后的样品，将其放至开盖机进样口'
        }
        if (this.eritem == 1 && i == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(2.584, 2.264, -2.978)
          this.$refs.seen.move(
            [2.642, 2.755, -0.145],
            [-20.67 / 180, -0.31 / 180, -0.12 / 180]
          )
          this.bztext = '点击检查供电系统、供水系统、排水系统是否正常'
        }

        // if (this.eritem == 2 && i == 3) {
        //   this.$refs.seen.initFileS(0)
        //   this.$refs.seen.twinklePoint(15.522, 1.211, -2.6)
        //   this.$refs.seen.move(
        //     [14.192, 2.092, -2.688],
        //     [-89.45 / 180, -58.44 / 180, -89.35 / 180]
        //   )
        //   this.bztext = '点击“开门”按钮，打开离心机机盖'
        // }
      }
    },
    eritem: {
      handler(i) {
        this.szuir = 0
        this.szuit = 0
        this.gzlshow = false
        this.gzllshow1 = false
        this.gzllshow2 = false
        this.szuiboxshow = false
        this.imgbgboxshow = false
        this.eritems = i
        this.sjstep = 1
        this.sjbox = true //三级菜单问题
        this.bztext = ''
        clearTimeout(this.timer)
        console.log('当前二级', i, this.taskstep)
        this.sjname = this.taskdata[this.taskstep - 1].erdata[i - 1].name
        console.log('当前二级菜单名称', this.sjname)
        if (i == 1 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.522, 1.211, -2.6)
          this.$refs.seen.move(
            [14.192, 2.092, -2.688],
            [-89.45 / 180, -58.44 / 180, -89.35 / 180]
          )
          this.$refs.seen.initFileS(0)
          this.bztext = '点击打开离心机电源'
        }
        if (i == 2 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.522, 1.211, -2.6)
          this.$refs.seen.move(
            [14.192, 2.092, -2.688],
            [-89.45 / 180, -58.44 / 180, -89.35 / 180]
          )
          this.$refs.seen.initFileS(0)
          this.bztext = '点击“开门”按钮，打开离心机机盖'
        }
        if (i == 3 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.529, 1.219, -1.719)
          this.$refs.seen.move(
            [14.125, 2.181, -2.372],
            [-89.73 / 180, -59.87 / 180, -89.69 / 180]
          )
          this.$refs.seen.initFileS(0)
          this.bztext = '点击平衡管，将其放入离心机中'
        }
        if (i == 4 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.593, 1.196, -2.612)
          this.$refs.seen.move(
            [15.042, 1.318, -2.688],
            [-89.61 / 180, -67.9 / 180, -89.58 / 180]
          )
          this.$refs.seen.initFileS(0)
          this.bztext = '点击离心机操作面板，设置参数'
        }
        if (i == 5 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.593, 1.196, -2.612)
          this.$refs.seen.move(
            [15.042, 1.318, -2.688],
            [-89.61 / 180, -67.9 / 180, -89.58 / 180]
          )
          this.$refs.seen.initFileS(0)
          this.bztext = '点击“启动”按钮，开始样品离心'
        }
        if (i == 6 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.593, 1.196, -2.612)
          this.$refs.seen.move(
            [15.042, 1.318, -2.688],
            [-89.61 / 180, -67.9 / 180, -89.58 / 180]
          )
          this.$refs.seen.initFileS(0)
          this.bztext = '点击“开门”按钮，打开离心机机盖'
        }
        if (i == 7 && this.taskstep == 3) {
          this.$refs.seen.initFileS(0)
          this.bztext =
            '点击离心后的样品，检查血量是否充足，是否溶血，避免出现凝块'
          this.$refs.seen.twinklePoint(15.466, 1.213, -3.625)
          this.$refs.seen.move(
            [13.837, 1.361, -3.565],
            [-90 / 180, -92.33 / 180, -90 / 180]
          )
        }
        if (i == 1 && this.taskstep == 4) {
          this.$refs.seen.initFileS(0)
          this.$refs.seen.twinklePoint(15.466, 1.213, -3.625)
          this.$refs.seen.move(
            [14.169, 1.818, -3.955],
            [-90.0 / 180, -66.79 / 180, -90.0 / 180]
          )
          this.bztext = '点击离心后的样品，将其放至开盖机进样口'
          this.$refs.seen.LiXinJi32.visible = true
        }
        if (i == 2 && this.taskstep == 4) {
          // this.$refs.seen.initFileS(0)
          // this.$refs.seen.twinklePoint(15.406, 1.583, -4.36)
          this.$refs.seen.move(
            [14.482, 2.014, -4.463],
            [-90.0 / 180, -55.29 / 180, -90.0 / 180]
          )
          this.$refs.seen.twinklePoint(15.406, 1.583, -4.36)
          // this.$refs.seen.move(
          //   [14.996, 1.596, -4.499],
          //   [-96.02 / 180, -75.21 / 180, -96.22 / 180]
          // )
          this.bztext = '点击开始按钮，开始开盖'
          //
          this.$refs.seen.LiXinJi32.visible = false
          // this.$nextTick(() => {
          //   this.$refs.seen.LiXinJi32.visible = false
          // })
        }
        if (i == 1 && this.taskstep == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(2.584, 2.264, -2.978)
          this.$refs.seen.move(
            [2.642, 2.755, -0.145],
            [-20.67 / 180, -0.31 / 180, -0.12 / 180]
          )
          this.bztext = '点击检查供电系统、供水系统、排水系统是否正常'
        }
        if (i == 2 && this.taskstep == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.469, 1.034, -3.704)
          this.$refs.seen.move(
            [0.476, 1.188, -2.469],
            [-14.22 / 180, 0.27 / 180, 0.07 / 180]
          )
          this.bztext = '点击电源键，打开仪器电源'
        }
        if (i == 6 && this.taskstep == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(4.521, 1.561, -3.432)
          this.$refs.seen.move(
            [4.488, 2.232, -2.218],
            [-29.4 / 180, -0.26 / 180, -0.15 / 180]
          )
          this.bztext = '点击打开试剂仓门'
        }
        if (i == 7 && this.taskstep == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(2.33, 0.742, -3.343)
          this.$refs.seen.move(
            [2.561, 1.361, -1.704],
            [-16.51 / 180, -0.29 / 180, -0.09 / 180]
          )
          this.bztext = '点击检查清洗液是否充足'
        }
        if (i == 8 && this.taskstep == 5 && this.sjstep == 1) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(-3.206, 1.686, -3.46)
          this.$refs.seen.move(
            [-1.836, 1.689, -1.071],
            [-6.77 / 180, 0.27 / 180, 0.03 / 180]
          )
          this.bztext = '点击冰箱，取出校准品'
        }
        if (i == 9 && this.taskstep == 5 && this.sjstep == 1) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(-3.206, 1.686, -3.46)
          this.$refs.seen.move(
            [-1.836, 1.689, -1.071],
            [-6.77 / 180, 0.27 / 180, 0.03 / 180]
          )
          this.bztext = '点击冰箱，取出质控品'
        }
        if (i == 11 && this.taskstep == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(-0.628, 1.527, -4.109)
          this.$refs.seen.move(
            [-0.613, 1.641, -2.773],
            [-13.69 / 180, -0.26 / 180, -0.06 / 180]
          )
          this.bztext = '点击电脑开始审核报告单，确认无误后签字'
        }
        if (i == 14 && this.taskstep == 5) {
          this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(0.469, 1.034, -3.704)
          this.$refs.seen.move(
            [0.476, 1.188, -2.469],
            [-14.22 / 180, 0.27 / 180, 0.07 / 180]
          )
          this.bztext = '关闭仪器电源'
        }
      },
      immediate: true,
      deep: true
    },
    eritems: {
      handler(i) {
        console.log('当前父组件eritems的值', i)
        this.tipstext = ''
        clearTimeout(this.timer)
        if (i == 2.1 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.533, 1.227, -1.758)
          this.$refs.seen.move(
            [14.125, 2.181, -2.372],
            [-89.73 / 180, -59.87 / 180, -89.69 / 180]
          )
          this.bztext = '点击待离心样品，将其放入离心机中'
        }
        if (i == 3.1 && this.taskstep == 3) {
          this.$refs.seen.twinklePoint(15.855, 1.867, -2.686)
          this.$refs.seen.move(
            [14.125, 2.181, -2.372],
            [-89.73 / 180, -59.87 / 180, -89.69 / 180]
          )
          this.bztext = '点击盖上离心机机盖'
        }
        if (i == 5.1 && this.taskstep == 3) {
          this.tipstext = '样品离心完成'
          this.timer = setTimeout(() => {
            this.tipstext = ''
            this.eritem = 6
            clearTimeout(this.timer)
          }, 1000)
        }
        if (i == 6.1 && this.taskstep == 3) {
          this.bztext = '点击取出离心完成后的样品'
          this.$refs.seen.twinklePoint(15.758, 1.454, -2.796)
          this.$refs.seen.move(
            [15.023, 2.219, -2.728],
            [-90 / 180, -41.98 / 180, -90 / 180]
          )
        }
        if (i == 6.2 && this.taskstep == 3) {
          this.bztext = '点击盖上离心机机盖'
          this.$refs.seen.twinklePoint(15.855, 1.867, -2.686)
          this.$refs.seen.move(
            [14.125, 2.181, -2.372],
            [-89.73 / 180, -59.87 / 180, -89.69 / 180]
          )
        }
        if (i == 6.3 && this.taskstep == 3) {
          this.bztext = '点击关闭离心机电源'
          this.$refs.seen.twinklePoint(15.522, 1.211, -2.6)
          this.$refs.seen.move(
            [14.192, 2.092, -2.688],
            [-89.45 / 180, -58.44 / 180, -89.35 / 180]
          )
        }

        if (i == 2.1 && this.taskstep == 5) {
          // this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(-0.021, 0.259, -3.805)
          this.$refs.seen.move(
            [-0.019, 0.511, -2.615],
            [-12.79 / 180, -0.57 / 180, -0.13 / 180]
          )
          this.bztext = '点击电源键，打开电脑'
        }
        if (i == 6.1 && this.taskstep == 5) {
          this.$refs.seen.twinklePoint(-3.333, 1.681, -3.546)
          this.$refs.seen.move(
            [-3.321, 1.647, -0.911],
            [-7.63 / 180, -1.15 / 180, -0.15 / 180]
          )
          this.bztext = '点击冰箱，取出试剂盒'
        }
        if (i == 6.2 && this.taskstep == 5) {
          // this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(4.521, 1.561, -3.432)
          this.$refs.seen.move(
            [4.488, 2.232, -2.218],
            [-29.4 / 180, -0.26 / 180, -0.15 / 180]
          )
          this.bztext = '点击添加试剂'
        }
        if (i == 6.3 && this.taskstep == 5) {
          // this.$refs.seen.initFileS(1)
          this.$refs.seen.twinklePoint(4.539, 1.377, -3.363)
          this.$refs.seen.move(
            [4.488, 2.232, -2.218],
            [-29.4 / 180, -0.26 / 180, -0.15 / 180]
          )
          this.bztext = '点击关闭仓门'
        }
        if (i == 8.1 && this.taskstep == 5 && this.sjstep == 1) {
          this.$refs.seen.twinklePoint(0.011, 1.13, -4.279)
          this.$refs.seen.move(
            [0, 1.305, -3.751],
            [-29.41 / 180, -1.51 / 180, -0.85 / 180]
          )
          this.bztext = '点击查看校准品ID号'
        }
        if (i == 8.5 && this.taskstep == 5 && this.sjstep == 5) {
          this.$refs.seen.twinklePoint(0.085, 1.141, -3.88)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '将校准品放入进样口'
        }
        if (i == 8.51 && this.taskstep == 5 && this.sjstep == 5) {
          this.$refs.seen.twinklePoint(0.69, 1.604, -4.17)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '关闭进样口盖子'
        }
        if (i == 8.71 && this.taskstep == 5 && this.sjstep == 7) {
          this.$refs.seen.twinklePoint(0.554, 1.148, -3.884)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '将校准品从进样口取出'
        }
        if (i == 8.72 && this.taskstep == 5 && this.sjstep == 7) {
          this.$refs.seen.twinklePoint(0.69, 1.604, -4.17)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '关闭进样口盖子'
        }
        if (i == 9.1 && this.taskstep == 5 && this.sjstep == 1) {
          this.$refs.seen.twinklePoint(0.016, 1.056, -3.905)
          this.$refs.seen.move(
            [0.003, 1.157, -3.279],
            [-19.12 / 180, -1.87 / 180, -0.65 / 180]
          )
          this.bztext = '点击查看质控品数量及批号'
        }
        if (i == 9.4 && this.taskstep == 5 && this.sjstep == 5) {
          this.$refs.seen.twinklePoint(0.045, 1.045, -3.898)
          this.$refs.seen.move(
            [0.581, 1.653, -3.029],
            [-33.15 / 180, -0.7 / 180, -0.46 / 180]
          )
          this.bztext = '将质控品放入进样口'
        }
        if (i == 9.41 && this.taskstep == 5 && this.sjstep == 5) {
          this.$refs.seen.twinklePoint(0.69, 1.604, -4.17)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '关闭进样口盖子'
        }
        if (i == 9.7 && this.taskstep == 5 && this.sjstep == 7) {
          this.$refs.seen.twinklePoint(0.554, 1.148, -3.884)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '将质控品从进样口取出'
        }
        if (i == 9.71 && this.taskstep == 5 && this.sjstep == 7) {
          this.$refs.seen.twinklePoint(0.69, 1.604, -4.17)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '关闭进样口盖子'
        }
        if (i == 10.3 && this.taskstep == 5 && this.sjstep == 3) {
          this.$refs.seen.twinklePoint(0.056, 1.16, -4.013)
          this.$refs.seen.move(
            [0.291, 1.962, -3.141],
            [-46.36 / 180, -0.97 / 180, -1.03 / 180]
          )
          this.bztext = '将标本放入进样口'
        }
        if (i == 10.31 && this.taskstep == 5 && this.sjstep == 3) {
          this.$refs.seen.twinklePoint(0.69, 1.604, -4.17)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '关闭进样口盖子'
        }
        if (i == 10.5 && this.taskstep == 5 && this.sjstep == 5) {
          this.$refs.seen.twinklePoint(0.554, 1.148, -3.884)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '将标本从进样口取出'
        }
        if (i == 10.51 && this.taskstep == 5 && this.sjstep == 5) {
          this.$refs.seen.twinklePoint(0.69, 1.604, -4.17)
          this.$refs.seen.move(
            [0.63, 2.056, -2.652],
            [-32.55 / 180, -0.49 / 180, -0.32 / 180]
          )
          this.bztext = '关闭进样口盖子'
        }
      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    erjifn(i) {
      this.eritem = i
      var flag = this.taskdata[this.taskstep - 1].erdata[i - 1].sandata
      // 判断一下当前是不是存在三级数据
      if (flag != undefined) {
        this.sjbox = !this.sjbox
      }
    },
    taskfn(i) {
      this.taskstep = i
      this.erstep = i
      this.eritem = 1
      this.erstepshow = false
      console.log('taskstep', this.taskstep)
    },
    closefn() {
      this.erstep = 0
      this.erstepshow = true
      // this.sjbox = false
      // console.log('现在二级', this.erstep)
    },
    tg() {
      this.$nextTick(() => {
        this.taskstep = 2
        this.erstep = 2
        console.log('this0', this.taskstep)
      })
    },
    sjstepfn(i) {
      this.sjstep = i
    },
    eritemfn(i) {
      // this.sjstep = 1
      // 判断当前 二级菜单下是不是有三级菜单测试
      if (this.taskdata[this.taskstep - 1].erdata[i - 1].sandata) {
        this.sjstep = 1
      }

      this.eritem = i
      console.log('切换二级成功')
    },
    eritemfns(i) {
      // this.eritem = i
      this.$refs.shfx.eritems = i
      console.log('执行了', this.$refs.shfx.eritems)
    },
    audioUrlfn(i) {
      this.audioUrl = i
    },
    bfwc(i) {
      if (i == require('@/images/radio/hs1.mp3')) {
        this.$refs.jmcxbz.eritems = 2.5
      }
      if (i == require('@/images/radio/hz1.mp3')) {
        this.$refs.jmcxbz.eritemfn(3)
      }
    },
    tipstextfn(i) {
      // console.log('触发提示')
      this.tipstext = i

      this.timer = setTimeout(() => {
        if (i == '正在进行样品离心，请稍后') {
          this.eritems = 5.1
        }
        if (i == '离心机电源已关闭') {
          this.eritem = 7
        }
        if (i == '离心后的样品无异常') {
          this.taskfn(4)
        }
        if (i == '供电系统、供水系统、排水系统无异常') {
          this.eritem = 2
        }
        if (i == '仪器电源已开启') {
          this.eritems = 2.1
        }
        if (i == '该校准品ID为C001') {
          this.sjstep = 2
        }
        if (i == '已查看质控品数量及批号') {
          this.sjstep = 2
        }
        if (i == '仪器电源已关闭') {
          this.$router.push({
            name: 'wcSy'
          })
        }
        this.tipstext = ''

        clearTimeout(this.timer)
      }, 1500)
    },
    gzlshowfn() {
      this.gzlshow = false
      this.$refs.seen.twinklePoint(-3, -3, -3)
      this.$refs.seen.move(
        [0.63, 2.056, -2.652],
        [-32.55 / 180, -0.49 / 180, -0.32 / 180]
      )
      if (this.taskstep == 5 && this.eritems == 9 && this.sjstep == 6) {
        this.$refs.seen.move(
          [2.653, 4.176, -1.853],
          [-50.28 / 180, -0.11 / 180, -0.14 / 180]
        )
        this.tipstextfn = '已开始质控'
        this.$refs.seen.playAction('19', '19')
        this.bztext = '等待质控完成'
      } else {
        this.$refs.seen.move(
          [2.653, 4.176, -1.853],
          [-50.28 / 180, -0.11 / 180, -0.14 / 180]
        )
        this.tipstextfn = '已开始校准'
        this.$refs.seen.playAction('11', '11')
        this.bztext = '等待校准完成'
      }
    },
    gzllshow2fn() {
      this.gzllshow2 = false
      this.gzllshow1 = false
      this.tipstextfn = '已开始分析'
      this.$refs.seen.playAction('26', '26')
      this.$refs.seen.move(
        [2.653, 4.176, -1.853],
        [-50.28 / 180, -0.11 / 180, -0.14 / 180]
      )
      this.bztext = '等待分析完成'
    }
  }
}
</script>

<style>
.bgys {
  background-color: #02284b;
  width: 100%;
  height: 100%;
}
</style>
